<?php
namespace Admin\Model;
use Think\Model;
/**
 * 幻灯片模型
 */
 class NavigationModel extends  Model{
 	
	public $_validate = array();
 	/**
	 * 幻灯片添加方法
	 */
	 public function addNav(){
		$this->_validate =array(
			array('nname','require','菜单名称不能为空'),
			array('nurl','require','菜单链接地址不能为空'),
		);
		if(!$this->create()){
			return false;
		}
		$data = $_POST;

		M('navigation')->add($data);
		return true;
			
	 }
	 
	 
	 
	 public function editNav(){
	 	$nid = I('get.nid');
		$this->_validate =array(
			array('nname','require','菜单名称不能为空'),
			array('nurl','require','菜单链接地址不能为空'),
		);
		if(!$this->create()){
			return false;
		}
		$data = $_POST;
		M('navigation')->where("nid='{$nid}'")->save($data);
		return true;
			
	 }
	 
 }
